home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ TrueType Font Substitutes.xpl < prev    next >
Text File  |  2002-07-13  |  5KB  |  147 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="8"
  3. "COUNT"="3"
  4. "UIPATH"="Appearance\Interface\TrueType Fonts"
  5. "NAME"="Font Substitutes Editor"
  6. "VERSION"="1.00"
  7. "LANGUAGE"="VBScript"
  8. "WARNING"="1"
  9. "TEXT 1"="Add"
  10. "TEXT 2"="Change"
  11. "TEXT 3"="Delete"
  12. "OSVERSION"="0001011"
  13. "DESCRIPTION 1"="In Short: This editor allows you to change all of the font substations that are configured on your system. Please be careful what you do, there is no backup of old values, all value are directly changed!"
  14. "DESCRIPTION 2"="Long Description:"
  15. "DESCRIPTION 3"="All programs you use on your PC use Fonts. When a program wants to show a text, it asks Windows to load the font (for example) "MS Sans Serif". Before Windows loads the fonts, Windows will check it's configuration if there is a substitute (replacement) for that font. If there is a substitute for the font in question, Windows will load this substituted font instead of the original font."
  16. "DESCRIPTION 4"="An example might explain this process a little bit further. The application "SimpleApp.exe" wants to display the text "Hello!" to the user. Since until now, no font is loaded, SimpleApp.exe asks Windows to load the font "MS Sans Serif". Windows looks in it's configuration if there is a substation (replacement) for "MS Sans Serif". Windows finds a replacement, in this case "Tahoma". Therefore Windows will NOT load "MS Sans Serif" but "Tahoma". Windows will then return the font "Tahoma" to SimpleApp.exe and SimpleApp.exe will use it to display the text "Hello!"."
  17. "AUTHOR"="Xteq Systems"
  18. "CONTACTURL"="http://www.xteq.com"
  19. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  20. "COMMENT 1"="Based on the setting found by Chris Pirillo [chris@lockergnome.com]!"
  21.  
  22.  
  23. sP="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"
  24.  
  25. dim iItems        'contains the total amount of the registry keys
  26. Dim aryItems()    'contains the name of the Registry paths (direct files starting with ".")
  27. Dim aryItemsLoc() 'contains the registry location  (\ShellNew or \ShellNew-)
  28. Dim aryDesc()     'contains the description of the items
  29.  
  30.  
  31. Sub Plugin_Initialize 
  32.  if RegPathExists(sP) then
  33.     Call ReadRegistry
  34.  else
  35.     Call Disable
  36.  end if
  37.  iItems=0
  38. End Sub
  39.  
  40.  
  41. Sub ReadRegistry
  42.     for l=1 to iItems
  43.         Call SetUIElement(l,"")
  44.     next 
  45.  
  46.     iItems=RegEnumValues(sP) 
  47.  
  48.     ReDim aryItems(iItems)
  49.     ReDim aryDesc(iItems)
  50.  
  51.     l=1
  52.     e=1
  53.  
  54.     sDebug=""
  55.  
  56.     'read all data from the path
  57.     For l=1 to iItems       
  58.         sItem=RegEnumElement(l)    
  59.  
  60.         aryItems(l)=sItem
  61.         aryDesc(l)=RegReadValue(sP & "\" & sItem)
  62.          
  63.         sDebug=sDebug & sItem
  64.     next
  65.     'Call DebugMsg(sDebug)
  66.  
  67.  
  68.  
  69.  
  70.     'AND NOW update the UI
  71.     for l=1 to iItems
  72.         Call SetUIElement(l,aryItems(l) & " -> " & aryDesc(l)) 'set data in X-Setup
  73.     Next
  74. End Sub
  75.  
  76.  
  77.  
  78.  
  79. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  80.  bChanged=false
  81.  
  82.  
  83.  if ElementIndex=1 then 'add
  84.     sVal1=InputWindow("Please enter the name of the font you want to replace, e.g. `Arial` (no quotes)","",1)
  85.     If sVal1="" then Exit Sub
  86.  
  87.     sVal2=InputWindow("Please enter the name of the font which should be used when an application requests the font `" & sVal1 & "`.","",1)
  88.     If sVal2="" then Exit Sub
  89.     
  90.     If RegValueExists(sP & "\" & sVal1) then
  91.        Call MsgWarning("There is already an entry for this font - please use the CHANGE button. No changes were made.")
  92.     else
  93.        Call RegWriteValue(sP & "\" & sVal1,sVal2,1)
  94.        bChanged=true
  95.     end if
  96.      
  97.  else
  98.  
  99.  if ElementSubIndex>0 then
  100.  
  101.     if ElementIndex=2 then 'change
  102.        sVal1=aryItems(ElementSubIndex)
  103.        sCurPath=sP & "\" & sVal1
  104.        s=RegReadValue(sCurPath)         
  105.  
  106.        sVal2=InputWindow("Please enter the name of the font which should be used when an application requests the font `" & sVal1 & "`.",s,1)
  107.        If sVal2="" then Exit Sub
  108.  
  109.        if IsEmpty(sVal2)=false then
  110.           Call RegWriteValue(sCurPath,sVal2,1)
  111.           bChanged=true 
  112.        end if
  113.     end if
  114.  
  115.     if ElementIndex=3 then 'delete
  116.        sVal1=InputWindow("To delete the selected entry, please press OK","YES",1)
  117.        if sVal1="YES" then          
  118.           sCurPath=sP & "\" & aryItems(ElementSubIndex)
  119.           Call RegDeleteValue(sCurPath)
  120.           bChanged=true
  121.        end if  
  122.     end if
  123.      
  124.  else
  125.     Call MsgWarning("Please select an item in the list.")
  126.  end if
  127.  
  128.  end if
  129.  
  130.  
  131.  
  132.     if bChanged=true then
  133.        'call the holy Windows API
  134.        Call IndicateSettingChange()
  135.  
  136.        're-read UI
  137.        Call ReadRegistry
  138.     end if
  139.  
  140.  
  141. End Sub
  142.  
  143.  
  144.  
  145. Sub Plugin_Terminate 
  146. End Sub
  147.